import { PartialType } from '@nestjs/mapped-types';
import { IsNotEmpty, IsNumber, IsString, IsBoolean, IsOptional } from 'class-validator';
import { DictData } from 'src/database/entitys/dict-data.entity';

export class CreateDictDataDto extends PartialType(DictData) {
  /**
   * 字典ID
   */
  @IsNumber({}, { message: '字典ID必须是数字' })
  @IsNotEmpty({ message: '字典ID不能为空' })
  dictId: number;

  /**
   * 字典标签
   */
  @IsString({ message: '字典标签必须是字符串' })
  @IsNotEmpty({ message: '字典标签不能为空' })
  label: string;

  /**
   * 字典键值
   */
  @IsString({ message: '字典键值必须是字符串' })
  @IsNotEmpty({ message: '字典键值不能为空' })
  value: string;

  /**
   * 状态
   */
  @IsBoolean({ message: '状态必须是布尔值' })
  @IsOptional()
  status?: boolean = true;

  /**
   * 排序
   */
  @IsNumber({}, { message: '排序必须是数字' })
  @IsOptional()
  orderNo?: number = 0;

  /**
   * 备注
   */
  @IsString({ message: '备注必须是字符串' })
  @IsOptional()
  remark?: string;
}
